<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<subassemblies class="subassembliesCss" :userItem="userItem" @hello="hello" />
		<view @click="toSubPackagesA(title)">subPackagesA</view>
		<view @click="toSubPackagesB(title)">subPackagesB</view>

		<!--  direction="" :show-icon="" :selected="" @onTabItemTap="" -->
	</view>
</template>

<script>
	import subassemblies from '@/subPackagesA/subassemblies/subassemblies.vue'
	export default {
		components: {
			subassemblies,
		},
		data() {
			return {
				title: 'Hello',
				userItem: ['张三', '李四', '王五', '老六']
			}
		},
		onLoad() {
			if (typeof this.$mp.page.getTabBar == 'function' && this.$mp.page.getTabBar()) this.$mp.page.getTabBar()
				.setData({
					selected: 0
				});
		},
		methods: {
			hello(user, index) {
				console.log(`索引${index} - ${user}，你好！`);
			},
			toSubPackagesA(title) {
				let obj = {
					title
				}
				uni.navigateTo({
					url: `/subPackagesA/index/index?obj=${encodeURIComponent(JSON.stringify(obj))}`
				})
			},
			toSubPackagesB(title) {
				let obj = {
					title
				}
				uni.navigateTo({
					url: `/subPackagesB/index/index?obj=${encodeURIComponent(JSON.stringify(obj))}`
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.subassembliesCss {
		width: 100vw;
	}
</style>